package com.jeecg.p3.commonluckymoney.service.impl;

import com.jeecg.p3.commonluckymoney.dao.WxActCommonluckymoneyAwardsDao;
import com.jeecg.p3.commonluckymoney.entity.WxActCommonluckymoneyAwards;
import com.jeecg.p3.commonluckymoney.service.WxActCommonluckymoneyAwardsService;
import org.jeecgframework.p3.core.utils.common.PageList;
import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.jeecgframework.p3.core.utils.common.PageQueryWrapper;
import org.jeecgframework.p3.core.utils.common.Pagenation;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("wxActCommonluckymoneyAwardsService")
public class WxActCommonluckymoneyAwardsServiceImpl implements WxActCommonluckymoneyAwardsService {
	@Resource
	private WxActCommonluckymoneyAwardsDao wxActCommonluckymoneyAwardsDao;

	@Override
	public void doAdd(WxActCommonluckymoneyAwards wxActCommonluckymoneyAwards) {
		wxActCommonluckymoneyAwardsDao.insert(wxActCommonluckymoneyAwards);
	}

	@Override
	public void doEdit(WxActCommonluckymoneyAwards wxActCommonluckymoneyAwards) {
		wxActCommonluckymoneyAwardsDao.update(wxActCommonluckymoneyAwards);
	}

	@Override
	public void doDelete(String id) {
		wxActCommonluckymoneyAwardsDao.delete(id);
	}

	@Override
	public WxActCommonluckymoneyAwards queryById(String id) {
		WxActCommonluckymoneyAwards wxActCommonluckymoneyAwards  = wxActCommonluckymoneyAwardsDao.get(id);
		return wxActCommonluckymoneyAwards;
	}

	@Override
	public PageList<WxActCommonluckymoneyAwards> queryPageList(
		PageQuery<WxActCommonluckymoneyAwards> pageQuery) {
		PageList<WxActCommonluckymoneyAwards> result = new PageList<WxActCommonluckymoneyAwards>();
		Integer itemCount = wxActCommonluckymoneyAwardsDao.count(pageQuery);
		PageQueryWrapper<WxActCommonluckymoneyAwards> wrapper = new PageQueryWrapper<>(pageQuery.getPageNo(), pageQuery.getPageSize(),itemCount, pageQuery.getQuery());
		List<WxActCommonluckymoneyAwards> list = wxActCommonluckymoneyAwardsDao.queryPageList(wrapper);
		Pagenation pagenation = new Pagenation(pageQuery.getPageNo(), itemCount, pageQuery.getPageSize());
		result.setPagenation(pagenation);
		result.setValues(list);
		return result;
	}

	@Override
	public List<WxActCommonluckymoneyAwards> queryAwardsByActIdAndCurrDate(String actid, String date) {
		return wxActCommonluckymoneyAwardsDao.queryAwardsByActIdAndCurrDate(actid,date);
	}

	@Override
	public List<WxActCommonluckymoneyAwards> queryAwardsByActId(String actId) {
		return wxActCommonluckymoneyAwardsDao.queryAwardsByActId(actId);
	}
	
}
